import request from "../utils/request"

//获取帖子列表
export function getPostByPage(page,rows,sectionId){
    return request({
        method: "get",
        url: `/api/v1/post/list/${sectionId}/${page}/${rows}`
    })
}
//添加帖子
export function addPost(postDTO){
    return request({
        method: "post",
        url: "/api/v1/post/addPost",
        data:{
            title: postDTO.title,
            tags: postDTO.tags,
            content: postDTO.content,
            userId: postDTO.userId,
        }
    })
}
//查找某个帖子
export function getPost(id){
    return request({
        method: "get",
        url: `/api/v1/post/detail/${id}`
    })
}

//获取推荐帖子
export function getRecomment(){
    return request({
        method: "get",
        url: `/api/v1/post/recommend`
    })
}
//删除帖子
export function removePost(postId){
    return request({
        method: "delete",
        url: `/api/v1/post/remove/${postId}`
    })
}
//搜索帖子
export function searchPost(title){
    return request({
        method: "get",
        url: `/api/v1/post/search/${title}`
    })
}
//获取用户的帖子
export function getUserPost(id){
    return request({
        method: "get",
        url: `/api/v1/post/userPost/${id}`
    })
}